/*!
 * vinculum
 * Copyright(c) 2017 azzly
 * MIT Licensed
 */
 
'use strict';

/**
 * Module dependencies.
 * @private
 */
const helper = require("../helper");
const CONST = require("../CONST");
const config = require("../config");
const debug = require("../debug")(__filename);
const error = require("../HTTPErrors");
const datasource = require("../datasource");
 
/**
 * module.
 */

module.exports = ()=>{
  return (req,res,next)=>{
		req.vinculum.session.clear().then(result=>{
			if(req.vinculum.params.redirect){
				res.vinculum.redirect(req.vinculum.params.redirect);
			}else{
				res.vinculum.send('loginOut success');
			}
		}).catch(err=>{
			res.vinculum.error(err);
		});
  }
};